<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件冒泡</title>
    <script>
        function clickDiv(){
            location.href = "01-引入方式.html";
            console.log("点击了div");
            //alert(event);
        }
        function clickA(e){
           document.getElementById("d").style.display = "none";
            console.log("点击了超链接");
            // alert(e);
            // cancelBubble属性:设置或返回事件是否应该不向上层级进行传播。
            // true:不向上传播,即:阻止事件冒泡
            // false:默认值,向上传播,事件冒泡
            e.cancelBubble = true;
        }
    </script>
</head>
<body>
<div id="d" style="width: 200px;height: 100px;background-color: red;" onclick="clickDiv()">
    <a href="javascript:;" onclick="clickA(event)">X</a>
</div>
</body>
</html>